const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  devServer:{
    proxy: {
      '/Alumnus': {
        target: 'http://localhost:8080', // 后端服务器地址
        changeOrigin: true, // 是否改变请求源
        pathRewrite: { '^/Alumnus': '/Alumnus' }, // 可选，重写路径
        onProxyReq: (proxyReq, req, res) => {
          console.log(`[Proxy Request] ${req.method} ${req.url} -> ${proxyReq.path}`);
        },
        onProxyRes: (proxyRes, req, res) => {
          console.log(`[Proxy Response] ${req.method} ${req.url} -> ${proxyRes.statusCode}`);
        },
        onError: (err, req, res) => {
          console.error(`[Proxy Error] ${req.method} ${req.url} -> ${err.message}`);
        }
      }
    }
  }
})
